package jrdcom.com.jrdcommonknowledge;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import butterknife.Bind;
import butterknife.ButterKnife;
import jrdcom.com.jrdcommonknowledge.Fragments.MainFragments;

public class MainActivity extends AppCompatActivity {

    @Bind(R.id.list_view_main)
    ListView listViewMain;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_main);

        getFragmentManager()
                .beginTransaction()
                .replace(R.id.main_fragment, new MainFragments())
                .addToBackStack(MainFragments.TAG)
                .commit();
    }

    @Override
    public void onBackPressed() {
        if(getFragmentManager().getBackStackEntryCount() > 0){
            getFragmentManager().popBackStack();
        }else{
            super.onBackPressed();
        }
    }
}
